package cn.lanqiao.print;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Customer {
    public static void main(String[] args) {
        //购买
//        Ink blackInk = new BlackInk();
//        Ink colorInk = new ColorInk();
//        Paper a4Paper = new A4Paper();
//        Paper b5Paper = new B5Paper();
//        Printer printer = new Printer("佳能");
//        //安装
//        printer.setInk(blackInk);
//        printer.setPaper(a4Paper);

//        ApplicationContext ctx = new ClassPathXmlApplicationContext("app.xml");
//        Printer printer = (Printer)ctx.getBean("printer");

        ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
        Printer printer = ctx.getBean(Printer.class);

        //操作打印
        printer.print("hello!");
    }
}
